package com.yubest.junit.proxy;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * cglib 代理类
 *
 * @Author: hweiyu
 * @Date: 2022/10/28 16:03
 */
public class CglibProxy implements MethodInterceptor {

    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("CglibProxy -> before");
        Object value = methodProxy.invokeSuper(o, objects);
        System.out.println("CglibProxy -> after");
        return value;
    }
}
